package org.bite.lesson02;

public class Demo_205 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            for(int i = 0; i < 5; i++){
                System.out.println("hello thread...");
                try{
                    Thread.sleep(1000);
                }catch(InterruptedException e){
                    e.printStackTrace();
                }
            }
            System.out.println("线程任务完成。");
        });

        System.out.println("启动之前查看线程是否存活：" + thread.isAlive());
        thread.start();
        System.out.println("启动之后查看线程是否存活：" + thread.isAlive());
        thread.join();
        Thread.sleep(1000);
        System.out.println("线程结束之后查看线程是否存活：" + thread.isAlive());    }
}
